
import urllib.request
url = 'https://www.mi.com/shop'
url = 'https://www.mi.com/shop/buy/detail?product_id=20618'
header = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'
}

request = urllib.request.Request(url=url,headers=header)
response = urllib.request.urlopen(request)
content = response.read()
content = content.decode('utf-8')
print(content)



# 保存到文件中
f = open('./download/mibuy.html','w',encoding='utf-8')
f.write(content)
f.close()








